﻿//跨浏览器解析xml
function parseXML(xml) {
    var xmlDom;
    if (typeof DOMParser != "undefined") {
        xmlDom = (new DOMParser()).parseFromString(xml, "text/xml");
        if (xmlDom.documentElement.getElementsByTagName("parseerror").length > 0) {
            throw new Error("解析错误");
        }
    } else if (typeof ActiveXObject != "undefined") {
        xmlDom = new ActiveXObject("MSXML2.DOMDocument.6.0");
        xmlDom.loadXML(xml);
        if (xmlDom.parseError != 0) {
            throw new Error("解析错误");
        }
    }else {
        throw new error("解析错误");
    }

    return xmlDom;
}